package leetcode.string;

public class IsUnique {

    public boolean isUnique(String astr) {
        int mask = 0;
        for (int i = 0; i < astr.length(); i++) {
            if (((mask >> astr.charAt(i)) & 1) == 1) {
                return false;
            } else {
                mask |= (1 << astr.charAt(i));
            }
        }
        return true;
    }

}
